package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import com.blankj.utilcode.util.ClipboardUtils;
import com.blankj.utilcode.util.ToastUtils;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityPhotoResultBinding;

public class PhotoResultActivity extends BaseAc<ActivityPhotoResultBinding> {

    public static String sResult;

    @Override
    protected int onCreate() {
        return R.layout.activity_photo_result;
    }

    @Override
    protected void initView() {
        mDataBinding.ivPhotoResultBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        mDataBinding.ivCopy.setOnClickListener(this);
        mDataBinding.ivTranslation.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.ivCopy://复制
                if (TextUtils.isEmpty(mDataBinding.tvRecResult.getText().toString().trim())) {
                    ToastUtils.showShort(R.string.no_content_copy_tips);
                } else {
                    ClipboardUtils.copyText(mDataBinding.tvRecResult.getText().toString().trim());
                }
                break;
            case R.id.ivTranslation://翻译文本
                PhotoTranslationActivity.sResult=sResult;
                startActivity(PhotoTranslationActivity.class);
                break;
        }
    }

    @Override
    protected void initData() {
        mDataBinding.tvRecResult.setText(sResult);
    }
}